import request from 'superagent';

/**
 * 获取某一个包下面的用户提交记录
 * @param {string|number} 包所属的id
 */
export const getSubmit = (id) => {
  return request.get('/audiorecord/getYFRecordList').query({
    id: JSON.stringify([id]),
  }).then(d => d.text).then(JSON.parse);
};

/**
 * 更新一条记录的状态
 * @param {string|number} id 记录的id
 * @param {string} state 记录的状态 enum [ 'pass', 'refuse' ]
 */
export const updateState = (id, state) => {
  return request.get('/audiorecord/updateRecordState').query({
    id,
    state,
  }).then(d => d.text).then(JSON.parse);
};
